-- CACL_SKY_EVENT_COST

-- 计算发起天空之城探索事件消耗
-- @param attrib    属性
return function(eventInfo)
    if type(eventInfo) ~= "table" then
        return;
    end

    local id = eventInfo["id"];

    -- 如果不是玩家、怪物、boss, 时空裂痕
    local rule = SkyExploreM.query(id, "rule");

    if rule ~= "boss" and rule ~= "monster" and rule ~= "player" and rule ~= "whirlpool" then
        return;
    end

    -- 失败次数
    local exploreLevel = eventInfo["explore_level"] or 0;
    local failTimes = SkyExploreM.calcFailTimes(eventInfo);
    if failTimes <= 0 then
        return;
    end

    if failTimes > 30 then
        failTimes = 30;
    end

    local base = exploreLevel * 5;
    local weight = math.pow(2, failTimes);

    local count = base * weight;

    -- 光环降低消耗
    local prop = PropM.combine(ME.user, "sky_strike_money", 1);
    count = PropM.apply(prop, count);

    return {["money"] = count, };
end
